<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.10"/>
<title>Introduction_to_Algorithms: IntroductionToAlgorithm::GraphAlgorithm::Graph&lt; N, VType &gt; Struct Template Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Introduction_to_Algorithms
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.10 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#pub-types">Public Types</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-attribs">Public Attributes</a> &#124;
<a href="#pub-static-attribs">Static Public Attributes</a> &#124;
<a href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">IntroductionToAlgorithm::GraphAlgorithm::Graph&lt; N, VType &gt; Struct Template Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Graph：图，算法导论22章22.1节  
 <a href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="graph_8h_source.html">graph.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-types"></a>
Public Types</h2></td></tr>
<tr class="memitem:a507632614d13e91d29acbf8acb0b0f0f"><td class="memItemLeft" align="right" valign="top">typedef int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a507632614d13e91d29acbf8acb0b0f0f">VIDType</a></td></tr>
<tr class="separator:a507632614d13e91d29acbf8acb0b0f0f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a77f6d3ef31203e0d6ebd2ed87928978a"><td class="memItemLeft" align="right" valign="top">typedef int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a77f6d3ef31203e0d6ebd2ed87928978a">EWeightType</a></td></tr>
<tr class="separator:a77f6d3ef31203e0d6ebd2ed87928978a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad1eb485d135eb8076a44b00904ae2f5a"><td class="memItemLeft" align="right" valign="top">typedef std::tuple&lt; <a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a507632614d13e91d29acbf8acb0b0f0f">VIDType</a>, <a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a507632614d13e91d29acbf8acb0b0f0f">VIDType</a>, <a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a77f6d3ef31203e0d6ebd2ed87928978a">EWeightType</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#ad1eb485d135eb8076a44b00904ae2f5a">EdgeTupleType</a></td></tr>
<tr class="separator:ad1eb485d135eb8076a44b00904ae2f5a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a95fc613ee7f50f11c84d56c19dc6d321"><td class="memItemLeft" align="right" valign="top">typedef VType&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a95fc613ee7f50f11c84d56c19dc6d321">VertexType</a></td></tr>
<tr class="separator:a95fc613ee7f50f11c84d56c19dc6d321"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a1effb22f7cc51898e54bbb3a5f549c95"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a1effb22f7cc51898e54bbb3a5f549c95">Graph</a> (<a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a77f6d3ef31203e0d6ebd2ed87928978a">EWeightType</a> val)</td></tr>
<tr class="memdesc:a1effb22f7cc51898e54bbb3a5f549c95"><td class="mdescLeft">&#160;</td><td class="mdescRight">显式构造函数，为图的矩阵指定<code>invalid_weight</code>  <a href="#a1effb22f7cc51898e54bbb3a5f549c95">More...</a><br /></td></tr>
<tr class="separator:a1effb22f7cc51898e54bbb3a5f549c95"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a554fe807fb375fe4e56e5b0a0ac21477"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a554fe807fb375fe4e56e5b0a0ac21477">Graph</a> ()</td></tr>
<tr class="memdesc:a554fe807fb375fe4e56e5b0a0ac21477"><td class="mdescLeft">&#160;</td><td class="mdescRight">默认构造函数  <a href="#a554fe807fb375fe4e56e5b0a0ac21477">More...</a><br /></td></tr>
<tr class="separator:a554fe807fb375fe4e56e5b0a0ac21477"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a172f460e7f689fa42dcb3f1130d3fa64"><td class="memItemLeft" align="right" valign="top"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a507632614d13e91d29acbf8acb0b0f0f">VIDType</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a172f460e7f689fa42dcb3f1130d3fa64">add_vertex</a> (const typename VertexType::KeyType &amp;key)</td></tr>
<tr class="memdesc:a172f460e7f689fa42dcb3f1130d3fa64"><td class="mdescLeft">&#160;</td><td class="mdescRight">add_vertex:添加一个顶点  <a href="#a172f460e7f689fa42dcb3f1130d3fa64">More...</a><br /></td></tr>
<tr class="separator:a172f460e7f689fa42dcb3f1130d3fa64"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad22898c16f9f614c0826bd62500317de"><td class="memItemLeft" align="right" valign="top"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a507632614d13e91d29acbf8acb0b0f0f">VIDType</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#ad22898c16f9f614c0826bd62500317de">add_vertex</a> (const typename VertexType::KeyType &amp;key, <a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a507632614d13e91d29acbf8acb0b0f0f">VIDType</a> id)</td></tr>
<tr class="memdesc:ad22898c16f9f614c0826bd62500317de"><td class="mdescLeft">&#160;</td><td class="mdescRight">add_vertex:添加一个顶点  <a href="#ad22898c16f9f614c0826bd62500317de">More...</a><br /></td></tr>
<tr class="separator:ad22898c16f9f614c0826bd62500317de"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae36e2ef188da844f75a673516a6c7225"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#ae36e2ef188da844f75a673516a6c7225">modify_vertex</a> (const typename VertexType::KeyType &amp;newkey, <a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a507632614d13e91d29acbf8acb0b0f0f">VIDType</a> id)</td></tr>
<tr class="memdesc:ae36e2ef188da844f75a673516a6c7225"><td class="mdescLeft">&#160;</td><td class="mdescRight">modify_vertex:修改一个顶点的数据  <a href="#ae36e2ef188da844f75a673516a6c7225">More...</a><br /></td></tr>
<tr class="separator:ae36e2ef188da844f75a673516a6c7225"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3ddca71ba690d09471a7de78bcaa6fea"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a3ddca71ba690d09471a7de78bcaa6fea">add_edge</a> (const <a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#ad1eb485d135eb8076a44b00904ae2f5a">EdgeTupleType</a> &amp;edge_tuple)</td></tr>
<tr class="memdesc:a3ddca71ba690d09471a7de78bcaa6fea"><td class="mdescLeft">&#160;</td><td class="mdescRight">add_edge:添加一条边  <a href="#a3ddca71ba690d09471a7de78bcaa6fea">More...</a><br /></td></tr>
<tr class="separator:a3ddca71ba690d09471a7de78bcaa6fea"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abda82467495ef0109b14061a6bbe84b9"><td class="memTemplParams" colspan="2">template&lt;typename Iterator &gt; </td></tr>
<tr class="memitem:abda82467495ef0109b14061a6bbe84b9"><td class="memTemplItemLeft" align="right" valign="top">void&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#abda82467495ef0109b14061a6bbe84b9">add_edges</a> (const Iterator &amp;begin, const Iterator &amp;end)</td></tr>
<tr class="memdesc:abda82467495ef0109b14061a6bbe84b9"><td class="mdescLeft">&#160;</td><td class="mdescRight">add_edges:添加一组边  <a href="#abda82467495ef0109b14061a6bbe84b9">More...</a><br /></td></tr>
<tr class="separator:abda82467495ef0109b14061a6bbe84b9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abfbc7f8a38017fd1422b5c6f1e8b6594"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#abfbc7f8a38017fd1422b5c6f1e8b6594">adjust_edge</a> (<a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a507632614d13e91d29acbf8acb0b0f0f">VIDType</a> id1, <a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a507632614d13e91d29acbf8acb0b0f0f">VIDType</a> id2, <a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a77f6d3ef31203e0d6ebd2ed87928978a">EWeightType</a> wt)</td></tr>
<tr class="memdesc:abfbc7f8a38017fd1422b5c6f1e8b6594"><td class="mdescLeft">&#160;</td><td class="mdescRight">adjust_edge:修改一条边的权重  <a href="#abfbc7f8a38017fd1422b5c6f1e8b6594">More...</a><br /></td></tr>
<tr class="separator:abfbc7f8a38017fd1422b5c6f1e8b6594"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0cadf10557297a2cb10aec457eb70b3f"><td class="memItemLeft" align="right" valign="top">const std::vector&lt; <a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#ad1eb485d135eb8076a44b00904ae2f5a">EdgeTupleType</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a0cadf10557297a2cb10aec457eb70b3f">edge_tuples</a> () const </td></tr>
<tr class="memdesc:a0cadf10557297a2cb10aec457eb70b3f"><td class="mdescLeft">&#160;</td><td class="mdescRight">edge_tuples:返回图中所有边的三元素元组集合，这里集合采用<code>std::vector&lt;std::tuple&lt;VIDType,VIDType,EWeightType&gt;&gt;</code>  <a href="#a0cadf10557297a2cb10aec457eb70b3f">More...</a><br /></td></tr>
<tr class="separator:a0cadf10557297a2cb10aec457eb70b3f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1a36b41adf54b242ff40610eae219eda"><td class="memItemLeft" align="right" valign="top">const std::vector&lt; <a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#ad1eb485d135eb8076a44b00904ae2f5a">EdgeTupleType</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a1a36b41adf54b242ff40610eae219eda">vertex_edge_tuples</a> (<a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a507632614d13e91d29acbf8acb0b0f0f">VIDType</a> id) const </td></tr>
<tr class="memdesc:a1a36b41adf54b242ff40610eae219eda"><td class="mdescLeft">&#160;</td><td class="mdescRight">vertex_edge_tuples:返回图中从指定顶点出发的边的三元素元组集合，这里集合采用<code>std::vector&lt;std::tuple&lt;VIDType,VIDType,EWeightType&gt;&gt;</code>  <a href="#a1a36b41adf54b242ff40610eae219eda">More...</a><br /></td></tr>
<tr class="separator:a1a36b41adf54b242ff40610eae219eda"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac6f3559ac73a84a45285d2906b9f7557"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#ac6f3559ac73a84a45285d2906b9f7557">has_edge</a> (<a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a507632614d13e91d29acbf8acb0b0f0f">VIDType</a> id_from, <a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a507632614d13e91d29acbf8acb0b0f0f">VIDType</a> id_to) const </td></tr>
<tr class="memdesc:ac6f3559ac73a84a45285d2906b9f7557"><td class="mdescLeft">&#160;</td><td class="mdescRight">has_edge:返回图中指定顶点之间是否存在边  <a href="#ac6f3559ac73a84a45285d2906b9f7557">More...</a><br /></td></tr>
<tr class="separator:ac6f3559ac73a84a45285d2906b9f7557"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9736f238bdedf0d6fccc064e6acea65d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a77f6d3ef31203e0d6ebd2ed87928978a">EWeightType</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a9736f238bdedf0d6fccc064e6acea65d">weight</a> (<a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a507632614d13e91d29acbf8acb0b0f0f">VIDType</a> id_from, <a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a507632614d13e91d29acbf8acb0b0f0f">VIDType</a> id_to) const </td></tr>
<tr class="memdesc:a9736f238bdedf0d6fccc064e6acea65d"><td class="mdescLeft">&#160;</td><td class="mdescRight">weight:返回图中指定顶点之间的边的权重  <a href="#a9736f238bdedf0d6fccc064e6acea65d">More...</a><br /></td></tr>
<tr class="separator:a9736f238bdedf0d6fccc064e6acea65d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aec06e55b6164700f65dcc08dafe79666"><td class="memItemLeft" align="right" valign="top">std::shared_ptr&lt; <a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html">Graph</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#aec06e55b6164700f65dcc08dafe79666">inverse</a> ()</td></tr>
<tr class="memdesc:aec06e55b6164700f65dcc08dafe79666"><td class="mdescLeft">&#160;</td><td class="mdescRight">inverse:返回图的一个镜像  <a href="#aec06e55b6164700f65dcc08dafe79666">More...</a><br /></td></tr>
<tr class="separator:aec06e55b6164700f65dcc08dafe79666"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a>
Public Attributes</h2></td></tr>
<tr class="memitem:aea254564996a6a172f001ebf7f3c5f65"><td class="memItemLeft" align="right" valign="top">std::array&lt; std::shared_ptr&lt; <a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a95fc613ee7f50f11c84d56c19dc6d321">VertexType</a> &gt;, N &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#aea254564996a6a172f001ebf7f3c5f65">vertexes</a></td></tr>
<tr class="separator:aea254564996a6a172f001ebf7f3c5f65"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a07a8f2eafc8175787a6ce1f26f1252d0"><td class="memItemLeft" align="right" valign="top">std::size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a07a8f2eafc8175787a6ce1f26f1252d0">next_empty_vertex</a></td></tr>
<tr class="separator:a07a8f2eafc8175787a6ce1f26f1252d0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a498323460ec613f12e1039afdca6c10a"><td class="memItemLeft" align="right" valign="top"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_matrix_graph.html">MatrixGraph</a>&lt; N &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a498323460ec613f12e1039afdca6c10a">matrix</a></td></tr>
<tr class="separator:a498323460ec613f12e1039afdca6c10a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4442db9dd1bbb7fe543353df4fa1ba9f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_a_d_j_list_graph.html">ADJListGraph</a>&lt; N &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a4442db9dd1bbb7fe543353df4fa1ba9f">adjList</a></td></tr>
<tr class="separator:a4442db9dd1bbb7fe543353df4fa1ba9f"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-attribs"></a>
Static Public Attributes</h2></td></tr>
<tr class="memitem:aba53db2c8cade306553fc1e03f138aa2"><td class="memItemLeft" align="right" valign="top">static const unsigned&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#aba53db2c8cade306553fc1e03f138aa2">NUM</a> =N</td></tr>
<tr class="separator:aba53db2c8cade306553fc1e03f138aa2"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><h3>template&lt;unsigned N, typename VType&gt;<br />
struct IntroductionToAlgorithm::GraphAlgorithm::Graph&lt; N, VType &gt;</h3>

<p>Graph：图，算法导论22章22.1节 </p>
<p>图的矩阵主要包含四个数据：</p>
<ul>
<li><code>matrix</code>：图的矩阵表示，类型为<code><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_matrix_graph.html" title="MatrixGraph：图的矩阵表示，算法导论22章22.1节 ">MatrixGraph</a>&lt;N&gt;</code></li>
<li><code>adjList</code>：图的邻接表表示，类型为<code><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_a_d_j_list_graph.html" title="ADJListGraph：图的邻接表表示，算法导论22章22.1节 ">ADJListGraph</a>&lt;N&gt;</code></li>
<li><code>vertexes</code>：顶点集合，类型为<code>std::array&lt;std::shared_ptr&lt;VertexType&gt;,N&gt;</code>。它是一个<code>std::array</code>，其元素类型为指向顶点的强引用</li>
<li><code>next_empty_vertex</code>：顶点集合中，下一个为空的位置，类型为<code>std::size_t</code>。它用于添加顶点。</li>
</ul>
<p>图支持插入、修改顶点操作，插入、修改边操作（由图的矩阵以及图的邻接表来代理），以及返回边、返回权重（由图的矩阵以及图的邻接表来代理）。 </p>

<p>Definition at line <a class="el" href="graph_8h_source.html#l00042">42</a> of file <a class="el" href="graph_8h_source.html">graph.h</a>.</p>
</div><h2 class="groupheader">Member Typedef Documentation</h2>
<a class="anchor" id="ad1eb485d135eb8076a44b00904ae2f5a"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;unsigned N, typename VType &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">typedef std::tuple&lt;<a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a507632614d13e91d29acbf8acb0b0f0f">VIDType</a>,<a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a507632614d13e91d29acbf8acb0b0f0f">VIDType</a>,<a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a77f6d3ef31203e0d6ebd2ed87928978a">EWeightType</a>&gt; <a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html">IntroductionToAlgorithm::GraphAlgorithm::Graph</a>&lt; N, VType &gt;::<a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#ad1eb485d135eb8076a44b00904ae2f5a">EdgeTupleType</a></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>边的三元素（顶点1编号，顶点2编号，权重)组成的元组 </p>

<p>Definition at line <a class="el" href="graph_8h_source.html#l00046">46</a> of file <a class="el" href="graph_8h_source.html">graph.h</a>.</p>

</div>
</div>
<a class="anchor" id="a77f6d3ef31203e0d6ebd2ed87928978a"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;unsigned N, typename VType &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">typedef int <a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html">IntroductionToAlgorithm::GraphAlgorithm::Graph</a>&lt; N, VType &gt;::<a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a77f6d3ef31203e0d6ebd2ed87928978a">EWeightType</a></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>权重的类型 </p>

<p>Definition at line <a class="el" href="graph_8h_source.html#l00045">45</a> of file <a class="el" href="graph_8h_source.html">graph.h</a>.</p>

</div>
</div>
<a class="anchor" id="a95fc613ee7f50f11c84d56c19dc6d321"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;unsigned N, typename VType &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">typedef VType <a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html">IntroductionToAlgorithm::GraphAlgorithm::Graph</a>&lt; N, VType &gt;::<a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a95fc613ee7f50f11c84d56c19dc6d321">VertexType</a></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>顶点的类型 </p>

<p>Definition at line <a class="el" href="graph_8h_source.html#l00047">47</a> of file <a class="el" href="graph_8h_source.html">graph.h</a>.</p>

</div>
</div>
<a class="anchor" id="a507632614d13e91d29acbf8acb0b0f0f"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;unsigned N, typename VType &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">typedef int <a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html">IntroductionToAlgorithm::GraphAlgorithm::Graph</a>&lt; N, VType &gt;::<a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a507632614d13e91d29acbf8acb0b0f0f">VIDType</a></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>顶点编号的类型 </p>

<p>Definition at line <a class="el" href="graph_8h_source.html#l00044">44</a> of file <a class="el" href="graph_8h_source.html">graph.h</a>.</p>

</div>
</div>
<h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a1effb22f7cc51898e54bbb3a5f549c95"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;unsigned N, typename VType &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html">IntroductionToAlgorithm::GraphAlgorithm::Graph</a>&lt; N, VType &gt;::<a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html">Graph</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a77f6d3ef31203e0d6ebd2ed87928978a">EWeightType</a>&#160;</td>
          <td class="paramname"><em>val</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">explicit</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>显式构造函数，为图的矩阵指定<code>invalid_weight</code> </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">val:无效权重值</td><td></td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="graph_8h_source.html#l00054">54</a> of file <a class="el" href="graph_8h_source.html">graph.h</a>.</p>

</div>
</div>
<a class="anchor" id="a554fe807fb375fe4e56e5b0a0ac21477"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;unsigned N, typename VType &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html">IntroductionToAlgorithm::GraphAlgorithm::Graph</a>&lt; N, VType &gt;::<a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html">Graph</a> </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>默认构造函数 </p>

<p>Definition at line <a class="el" href="graph_8h_source.html#l00057">57</a> of file <a class="el" href="graph_8h_source.html">graph.h</a>.</p>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="a3ddca71ba690d09471a7de78bcaa6fea"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;unsigned N, typename VType &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html">IntroductionToAlgorithm::GraphAlgorithm::Graph</a>&lt; N, VType &gt;::add_edge </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#ad1eb485d135eb8076a44b00904ae2f5a">EdgeTupleType</a> &amp;&#160;</td>
          <td class="paramname"><em>edge_tuple</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>add_edge:添加一条边 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">edge_tuple:一条边的三元素元组</td><td>为了便于计算，添加边时并不是添加<code><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_edge.html" title="Edge：图的边，算法导论22章22.1节 ">Edge</a></code>类型，而是<code>std::tuple&lt;VIDType,VIDType,EWeightType&gt;</code>类型的值。</td></tr>
  </table>
  </dd>
</dl>
<p>添加边之前如果边指定的任何一个顶点无效，则抛出异常：</p>
<ul>
<li>如果指定的顶点<code>id</code>不在<code>[0,N)</code>之间，则无效</li>
<li>如果不存在某个顶点与指定的顶点<code>id</code>相同，则无效</li>
</ul>
<p>在添加边时，同时向图的矩阵、图的邻接表中添加边</p>
<p>如果添加的边是无效权重，则直接返回而不添加 </p>

<p>Definition at line <a class="el" href="graph_8h_source.html#l00129">129</a> of file <a class="el" href="graph_8h_source.html">graph.h</a>.</p>

</div>
</div>
<a class="anchor" id="abda82467495ef0109b14061a6bbe84b9"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;unsigned N, typename VType &gt; </div>
<div class="memtemplate">
template&lt;typename Iterator &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html">IntroductionToAlgorithm::GraphAlgorithm::Graph</a>&lt; N, VType &gt;::add_edges </td>
          <td>(</td>
          <td class="paramtype">const Iterator &amp;&#160;</td>
          <td class="paramname"><em>begin</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const Iterator &amp;&#160;</td>
          <td class="paramname"><em>end</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>add_edges:添加一组边 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">begin:边容器的起始迭代器</td><td></td></tr>
    <tr><td class="paramname">end:边容器的终止迭代器</td><td>为了便于计算，添加边时并不是添加<code><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_edge.html" title="Edge：图的边，算法导论22章22.1节 ">Edge</a></code>类型，而是<code>std::tuple&lt;VIDType,VIDType,EWeightType&gt;</code>类型的值</td></tr>
  </table>
  </dd>
</dl>
<p>在添加边时，同时向图的矩阵、图的邻接表中添加边 </p>

<p>Definition at line <a class="el" href="graph_8h_source.html#l00151">151</a> of file <a class="el" href="graph_8h_source.html">graph.h</a>.</p>

</div>
</div>
<a class="anchor" id="a172f460e7f689fa42dcb3f1130d3fa64"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;unsigned N, typename VType &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a507632614d13e91d29acbf8acb0b0f0f">VIDType</a> <a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html">IntroductionToAlgorithm::GraphAlgorithm::Graph</a>&lt; N, VType &gt;::add_vertex </td>
          <td>(</td>
          <td class="paramtype">const typename VertexType::KeyType &amp;&#160;</td>
          <td class="paramname"><em>key</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>add_vertex:添加一个顶点 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">key:顶点存放的数据</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>: 顶点的id</dd></dl>
<p>如果已经有了N个顶点，则图的顶点已满，则抛出<code>std::invalid_argument</code>异常.</p>
<p>在每一次添加顶点之前会从<code>next_empty_vertex·指定的位置处开始寻找可以添加顶点的地方。如果找不到可以添加顶点的地方，则抛出</code>std::invalid_argument`异常 </p>

<p>Definition at line <a class="el" href="graph_8h_source.html#l00068">68</a> of file <a class="el" href="graph_8h_source.html">graph.h</a>.</p>

</div>
</div>
<a class="anchor" id="ad22898c16f9f614c0826bd62500317de"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;unsigned N, typename VType &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a507632614d13e91d29acbf8acb0b0f0f">VIDType</a> <a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html">IntroductionToAlgorithm::GraphAlgorithm::Graph</a>&lt; N, VType &gt;::add_vertex </td>
          <td>(</td>
          <td class="paramtype">const typename VertexType::KeyType &amp;&#160;</td>
          <td class="paramname"><em>key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a507632614d13e91d29acbf8acb0b0f0f">VIDType</a>&#160;</td>
          <td class="paramname"><em>id</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>add_vertex:添加一个顶点 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">key:顶点存放的数据</td><td></td></tr>
    <tr><td class="paramname">id:指定该顶点的&lt;tt&gt;id&lt;/tt&gt;</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>: 顶点的id</dd></dl>
<ul>
<li>如果<code>id&lt;0</code>或者<code>id&gt;=N</code>，则抛出异常。因为正常的顶点<code>id</code>在<code>[0,N)</code>之间</li>
<li>如果已经存在某个顶点的<code>id</code>为指定的<code>id</code>，则抛出异常 </li>
</ul>

<p>Definition at line <a class="el" href="graph_8h_source.html#l00088">88</a> of file <a class="el" href="graph_8h_source.html">graph.h</a>.</p>

</div>
</div>
<a class="anchor" id="abfbc7f8a38017fd1422b5c6f1e8b6594"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;unsigned N, typename VType &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html">IntroductionToAlgorithm::GraphAlgorithm::Graph</a>&lt; N, VType &gt;::adjust_edge </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a507632614d13e91d29acbf8acb0b0f0f">VIDType</a>&#160;</td>
          <td class="paramname"><em>id1</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a507632614d13e91d29acbf8acb0b0f0f">VIDType</a>&#160;</td>
          <td class="paramname"><em>id2</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a77f6d3ef31203e0d6ebd2ed87928978a">EWeightType</a>&#160;</td>
          <td class="paramname"><em>wt</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>adjust_edge:修改一条边的权重 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">id1:待修改边的第一个顶点</td><td></td></tr>
    <tr><td class="paramname">id2:待修改边的第二个顶点</td><td></td></tr>
    <tr><td class="paramname">wt:新的权重</td><td>修改边权重之前如果边指定的任何一个顶点无效，则抛出异常：</td></tr>
  </table>
  </dd>
</dl>
<ul>
<li>如果指定的顶点<code>id</code>不在<code>[0,N)</code>之间，则无效</li>
<li>如果不存在某个顶点与指定的顶点<code>id</code>相同，则无效 </li>
</ul>

<p>Definition at line <a class="el" href="graph_8h_source.html#l00174">174</a> of file <a class="el" href="graph_8h_source.html">graph.h</a>.</p>

</div>
</div>
<a class="anchor" id="a0cadf10557297a2cb10aec457eb70b3f"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;unsigned N, typename VType &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">const std::vector&lt;<a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#ad1eb485d135eb8076a44b00904ae2f5a">EdgeTupleType</a>&gt; <a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html">IntroductionToAlgorithm::GraphAlgorithm::Graph</a>&lt; N, VType &gt;::edge_tuples </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>edge_tuples:返回图中所有边的三元素元组集合，这里集合采用<code>std::vector&lt;std::tuple&lt;VIDType,VIDType,EWeightType&gt;&gt;</code> </p>
<dl class="section return"><dt>Returns</dt><dd>:图中所有边的三元素元组集合</dd></dl>
<p>要求图的矩阵和图的邻接表都返回同样的结果 </p>

<p>Definition at line <a class="el" href="graph_8h_source.html#l00189">189</a> of file <a class="el" href="graph_8h_source.html">graph.h</a>.</p>

</div>
</div>
<a class="anchor" id="ac6f3559ac73a84a45285d2906b9f7557"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;unsigned N, typename VType &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">bool <a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html">IntroductionToAlgorithm::GraphAlgorithm::Graph</a>&lt; N, VType &gt;::has_edge </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a507632614d13e91d29acbf8acb0b0f0f">VIDType</a>&#160;</td>
          <td class="paramname"><em>id_from</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a507632614d13e91d29acbf8acb0b0f0f">VIDType</a>&#160;</td>
          <td class="paramname"><em>id_to</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>has_edge:返回图中指定顶点之间是否存在边 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">id_from</td><td>第一个顶点的<code>id</code> </td></tr>
    <tr><td class="paramname">id_to</td><td>第二个顶点的<code>id</code> </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>:第一个顶点和第二个顶点之间是否存在边</dd></dl>
<p>要求图的矩阵和图的邻接表都返回同样的结果</p>
<p>如果边指定的任何一个顶点无效，则抛出异常：</p>
<ul>
<li>如果指定的顶点<code>id</code>不在<code>[0,N)</code>之间，则无效</li>
<li>如果不存在某个顶点与指定的顶点<code>id</code>相同，则无效 </li>
</ul>

<p>Definition at line <a class="el" href="graph_8h_source.html#l00253">253</a> of file <a class="el" href="graph_8h_source.html">graph.h</a>.</p>

</div>
</div>
<a class="anchor" id="aec06e55b6164700f65dcc08dafe79666"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;unsigned N, typename VType &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">std::shared_ptr&lt;<a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html">Graph</a>&gt; <a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html">IntroductionToAlgorithm::GraphAlgorithm::Graph</a>&lt; N, VType &gt;::inverse </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>inverse:返回图的一个镜像 </p>
<dl class="section return"><dt>Returns</dt><dd>:图的一个镜像的一个强引用</dd></dl>
<p>图的一个镜像也是一个图，它与原图有以下关系：</p>
<ul>
<li>图的镜像的顶点与原图的顶点相同</li>
<li>图的镜像的边是原图的边的反向</li>
</ul>
<p><code>inverse</code>方法首先新建一个图，再根据原图的顶点来执行顶点的深拷贝。然后再获取原图的边的反向边，将该反向边作为镜像图的边 </p>

<p>Definition at line <a class="el" href="graph_8h_source.html#l00299">299</a> of file <a class="el" href="graph_8h_source.html">graph.h</a>.</p>

</div>
</div>
<a class="anchor" id="ae36e2ef188da844f75a673516a6c7225"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;unsigned N, typename VType &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html">IntroductionToAlgorithm::GraphAlgorithm::Graph</a>&lt; N, VType &gt;::modify_vertex </td>
          <td>(</td>
          <td class="paramtype">const typename VertexType::KeyType &amp;&#160;</td>
          <td class="paramname"><em>newkey</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a507632614d13e91d29acbf8acb0b0f0f">VIDType</a>&#160;</td>
          <td class="paramname"><em>id</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>modify_vertex:修改一个顶点的数据 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">newkey:新的数据</td><td></td></tr>
    <tr><td class="paramname">id:指定该顶点的&lt;tt&gt;id&lt;/tt&gt;</td><td><ul>
<li>如果<code>id&lt;0</code>或者<code>id&gt;=N</code>，则抛出异常。因为正常的顶点<code>id</code>在<code>[0,N)</code>之间</li>
<li>如果不存在某个顶点的<code>id</code>为指定的<code>id</code>，则抛出异常 </li>
</ul>
</td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="graph_8h_source.html#l00105">105</a> of file <a class="el" href="graph_8h_source.html">graph.h</a>.</p>

</div>
</div>
<a class="anchor" id="a1a36b41adf54b242ff40610eae219eda"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;unsigned N, typename VType &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">const std::vector&lt;<a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#ad1eb485d135eb8076a44b00904ae2f5a">EdgeTupleType</a>&gt; <a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html">IntroductionToAlgorithm::GraphAlgorithm::Graph</a>&lt; N, VType &gt;::vertex_edge_tuples </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a507632614d13e91d29acbf8acb0b0f0f">VIDType</a>&#160;</td>
          <td class="paramname"><em>id</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>vertex_edge_tuples:返回图中从指定顶点出发的边的三元素元组集合，这里集合采用<code>std::vector&lt;std::tuple&lt;VIDType,VIDType,EWeightType&gt;&gt;</code> </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">id</td><td>指定顶点<code>id</code> </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>:图中指定顶点出发的边的三元素元组集合</dd></dl>
<p>要求图的矩阵和图的邻接表都返回同样的结果</p>
<ul>
<li>如果指定的顶点<code>id</code>不在<code>[0,N)</code>之间，则无效</li>
<li>如果不存在某个顶点与指定的顶点<code>id</code>相同，则无效 </li>
</ul>

<p>Definition at line <a class="el" href="graph_8h_source.html#l00217">217</a> of file <a class="el" href="graph_8h_source.html">graph.h</a>.</p>

</div>
</div>
<a class="anchor" id="a9736f238bdedf0d6fccc064e6acea65d"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;unsigned N, typename VType &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a77f6d3ef31203e0d6ebd2ed87928978a">EWeightType</a> <a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html">IntroductionToAlgorithm::GraphAlgorithm::Graph</a>&lt; N, VType &gt;::weight </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a507632614d13e91d29acbf8acb0b0f0f">VIDType</a>&#160;</td>
          <td class="paramname"><em>id_from</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a507632614d13e91d29acbf8acb0b0f0f">VIDType</a>&#160;</td>
          <td class="paramname"><em>id_to</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>weight:返回图中指定顶点之间的边的权重 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">id_from</td><td>第一个顶点的<code>id</code> </td></tr>
    <tr><td class="paramname">id_to</td><td>第二个顶点的<code>id</code> </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>:第一个顶点和第二个顶点之间的边的权重</dd></dl>
<p>要求图的矩阵和图的邻接表都返回同样的结果</p>
<p>如果边指定的任何一个顶点无效，则抛出异常：</p>
<ul>
<li>如果指定的顶点<code>id</code>不在<code>[0,N)</code>之间，则无效</li>
<li>如果不存在某个顶点与指定的顶点<code>id</code>相同，则无效 </li>
</ul>

<p>Definition at line <a class="el" href="graph_8h_source.html#l00278">278</a> of file <a class="el" href="graph_8h_source.html">graph.h</a>.</p>

</div>
</div>
<h2 class="groupheader">Member Data Documentation</h2>
<a class="anchor" id="a4442db9dd1bbb7fe543353df4fa1ba9f"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;unsigned N, typename VType &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_a_d_j_list_graph.html">ADJListGraph</a>&lt;N&gt; <a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html">IntroductionToAlgorithm::GraphAlgorithm::Graph</a>&lt; N, VType &gt;::adjList</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="graph_8h_source.html#l00319">319</a> of file <a class="el" href="graph_8h_source.html">graph.h</a>.</p>

</div>
</div>
<a class="anchor" id="a498323460ec613f12e1039afdca6c10a"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;unsigned N, typename VType &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_matrix_graph.html">MatrixGraph</a>&lt;N&gt; <a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html">IntroductionToAlgorithm::GraphAlgorithm::Graph</a>&lt; N, VType &gt;::matrix</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="graph_8h_source.html#l00318">318</a> of file <a class="el" href="graph_8h_source.html">graph.h</a>.</p>

</div>
</div>
<a class="anchor" id="a07a8f2eafc8175787a6ce1f26f1252d0"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;unsigned N, typename VType &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">std::size_t <a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html">IntroductionToAlgorithm::GraphAlgorithm::Graph</a>&lt; N, VType &gt;::next_empty_vertex</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="graph_8h_source.html#l00317">317</a> of file <a class="el" href="graph_8h_source.html">graph.h</a>.</p>

</div>
</div>
<a class="anchor" id="aba53db2c8cade306553fc1e03f138aa2"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;unsigned N, typename VType &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">const unsigned <a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html">IntroductionToAlgorithm::GraphAlgorithm::Graph</a>&lt; N, VType &gt;::NUM =N</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>顶点的最大容量 </p>

<p>Definition at line <a class="el" href="graph_8h_source.html#l00048">48</a> of file <a class="el" href="graph_8h_source.html">graph.h</a>.</p>

</div>
</div>
<a class="anchor" id="aea254564996a6a172f001ebf7f3c5f65"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;unsigned N, typename VType &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">std::array&lt;std::shared_ptr&lt;<a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html#a95fc613ee7f50f11c84d56c19dc6d321">VertexType</a>&gt;,N&gt; <a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html">IntroductionToAlgorithm::GraphAlgorithm::Graph</a>&lt; N, VType &gt;::vertexes</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="graph_8h_source.html#l00316">316</a> of file <a class="el" href="graph_8h_source.html">graph.h</a>.</p>

</div>
</div>
<hr/>The documentation for this struct was generated from the following file:<ul>
<li>src/graph_algorithms/basic_graph/graph_representation/graph/<a class="el" href="graph_8h_source.html">graph.h</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="namespace_introduction_to_algorithm.html">IntroductionToAlgorithm</a></li><li class="navelem"><a class="el" href="namespace_introduction_to_algorithm_1_1_graph_algorithm.html">GraphAlgorithm</a></li><li class="navelem"><a class="el" href="struct_introduction_to_algorithm_1_1_graph_algorithm_1_1_graph.html">Graph</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.10 </li>
  </ul>
</div>
</body>
</html>
